<script setup lang="ts">
import axios from 'axios';
import { ref } from 'process';
import { reactive } from 'vue';

// axios.get('https://open.douyucdn.cn/api/RoomApi/live').then(res => {
//     console.log(res);
// })
// 定义直播列表
export interface ExampleGenerate {
    error: number;
    data:  Datum[];
}

export interface Datum {
    room_id:   number;
    room_src:  string;
    room_name: string;
    owner_uid: string;
    online:    number;
    hn:        number;
    nickname:  string;
    url:       string;
}
let liveList:ExampleGenerate = reactive({
    error: 0,
    data: []
});


axios.get('https://open.douyucdn.cn/api/RoomApi/live').then(res => {
    console.log(res);
    liveList = res.data;
})
</script>
<template>
    <main class="box">
        <header class="header">
            <span>直播列表</span>
            
        </header>

        <div class="content">
            <span>{{ liveList.data }}</span>
        </div>
    </main>
</template>